Imports System.Data.OleDb
Imports BUS
Imports DTO
Public Class frmThongKeTheoDoanhThu
    Protected Function ConnectionData() As OleDbConnection
        Dim strCn As String
        strCn = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = QLKS.mdb"
        Dim cn As New OleDbConnection(strCn)
        cn.Open()
        Return cn
    End Function
    Public Sub inThongKe(ByVal tungay, ByVal denngay)
        Dim cn As OleDbConnection
        cn = Me.ConnectionData()
        Dim strSQL As String
        strSQL = "SELECT HoaDon.MaHoaDon, HoaDon.TenHoaDon, HoaDon.MaPhieuThue, HoaDon.NgayLapHoaDon, HoaDon.TongTien    FROM(HoaDon)WHERE (((HoaDon.NgayLapHoaDon) Between #" + tungay + "# And #" + denngay + "#));"
        Dim da As OleDbDataAdapter
        da = New OleDbDataAdapter(strSQL, cn)
        Dim cmb As New OleDbCommandBuilder(da)
        Dim DataSet1 As New DataSet()
        Dim dt As New DataTable
        da.Fill(dt)
        Me.cryThongKeDoanhThu1.SetDataSource(dt)
        Me.CrystalReportViewer1.ReportSource = cryThongKeDoanhThu1
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load
        Dim cn As OleDbConnection
        cn = Me.ConnectionData()
        Dim strSQL As String
        strSQL = "SELECT HoaDon.MaHoaDon, HoaDon.TenHoaDon, HoaDon.MaPhieuThue, HoaDon.NgayLapHoaDon, HoaDon.TongTien    FROM(HoaDon)"
        Dim da As OleDbDataAdapter
        da = New OleDbDataAdapter(strSQL, cn)
        Dim cmb As New OleDbCommandBuilder(da)
        Dim DataSet1 As New DataSet()
        Dim dt As New DataTable
        da.Fill(dt)
        Me.cryThongKeDoanhThu1.SetDataSource(dt)
        Me.CrystalReportViewer1.ReportSource = cryThongKeDoanhThu1
    End Sub
End Class